
//Unit root test
 xtunitroot fisher  lnmaxUN_troops if year>1989 & cow!=347  & sample1==1, dfuller lags(0) drift
 xtunitroot fisher  max_troops if year>1989 & cow!=347 & sample1==1, dfuller lags(0) drift
 xtunitroot fisher  ln_max_total_peacekeeper if year>1989 & cow!=347 & sample1==1, dfuller lags(0) drift
xtunitroot fisher max_total_peacekeeper if year>1989 & cow!=347 & sample1==1, dfuller lags(0) drift
xtunitroot fisher troop_dummy if year>1989 & cow!=347 & sample1==1, dfuller lags(0) drift 
 //Table 2
 //Model 1
xtreg  lnmaxUN_troops  L.KOFPoGIdj L.vdem_liberal L.wdi_expmil L.wdi_afpt L.wdi_gdpgr ///
  L.wdi_trade L.wdi_gdpcappppcur L.ucdp_type3_4 L.ucdp_type2_new peacekeeinglast10_y_n ///
  if year>1989 & sample1==1, fe cluster(cow)  
vif, uncentered
estat ic
//Figure 3
margins, at ( L.KOFPoGIdj=(0(5)100))
marginsplot

//Model 2 foreign aid committment variable
xtreg  lnmaxUN_troops  L.KOFPoGIdj L.vdem_liberal L.wdi_expmil L.wdi_afpt L.wdi_gdpgr ///
L.wdi_trade L.wdi_gdpcappppcur  L.ucdp_type3_4 L.ucdp_type2_new L.lnaid_crsc peacekeeinglast10_y_n ///
if year>1989 & sample==1, fe cluster(cow)

vif, uncentered
estat ic

//Model 3 with human rights practice
xtreg  lnmaxUN_troops  L.KOFPoGIdj L.vdem_liberal L.wdi_expmil L.wdi_afpt L.wdi_gdpgr ///
L.wdi_trade L.wdi_gdpcappppcur L.ucdp_type3_4 L.ucdp_type2_new peacekeeinglast10_y_n ///
L.gd_ptsa L.lnaid_crsc if year>1989 & sample1==1, fe cluster(cow)
vif, uncentered
estat ic

//Model 4 with demand for deployment
xtreg  lnmaxUN_troops  L.fre_conflict L.KOFPoGIdj L.vdem_liberal L.wdi_expmil L.wdi_afpt ///
L.wdi_gdpgr L.wdi_trade L.wdi_gdpcappppcur L.ucdp_type3_4 L.ucdp_type2_new peacekeeinglast10_y_n ///
if year>1989 & sample1==1, fe cluster(cow)
vif, uncentered
estat ic

  
//Table 2
//Model 5 zero inflated negative binomial model
zinb max_troops  KOFPoGIdj vdem_liberal wdi_expmil wdi_afpt wdi_gdpgr ///
wdi_trade wdi_gdpcappppcur ucdp_type3_4 ucdp_type2_new peacekeeinglast10_y_n ///
if year>1989 & sample1==1, cluster(cow)  inflate(_cons) 

//Model 6 population average model for bindary dependent variable 
xtgee troop_dummy  KOFPoGIdj vdem_liberal wdi_expmil wdi_afpt wdi_gdpgr ///
wdi_trade wdi_gdpcappppcur ucdp_type3_4 ucdp_type2_new peacekeeinglast10_y_n ///
if year>1989 & sample1==1, family(binomial)link(logit) vce(robust)    



 
  
//Appendix Table 1  

//Replicates Model 6 by excluding highly embaded states only below 75  & liberal democracy below .75 in vdem & excludes six high contributing countries
//Model 1
xtreg  lnmaxUN_troops  L.KOFPoGIdj L.vdem_liberal L.wdi_expmil L.wdi_afpt L.wdi_gdpgr ///
  L.wdi_trade L.wdi_gdpcappppcur L.ucdp_type3_4 L.ucdp_type2_new peacekeeinglast10_y_n ///
  if year>1989 & sample1==1 & KOFPoGIdj<75 , fe cluster(cow)  
vif, uncentered
estat ic

//Model 2
xtreg  lnmaxUN_troops  L.KOFPoGIdj L.vdem_liberal L.wdi_expmil L.wdi_afpt L.wdi_gdpgr ///
  L.wdi_trade L.wdi_gdpcappppcur L.ucdp_type3_4 L.ucdp_type2_new peacekeeinglast10_y_n ///
  if year>1989 & sample1==1 & vdem_liberal<.75 , fe cluster(cow)  
vif, uncentered
estat ic

//Model 3
xtreg  lnmaxUN_troops  L.KOFPoGIdj L.vdem_liberal L.wdi_expmil L.wdi_afpt L.wdi_gdpgr ///
  L.wdi_trade L.wdi_gdpcappppcur L.ucdp_type3_4 L.ucdp_type2_new peacekeeinglast10_y_n ///
  if year>1989 & sample1==1 & sample1==1 & cname!="Pakistan (1971-)" & cname!="Nepal" & ///
  cname!="India" & cname!="Bangladesh" & cname!="Nigeria" & cname!="Ethiopia (1993-)", fe cluster(cow) 
vif, uncentered
estat ic


//Appendix Table 2: All peacekeeping contribution 
//Model 4
xtreg  ln_max_total_peacekeeper  L.KOFPoGIdj L.vdem_liberal L.wdi_expmil L.wdi_afpt L.wdi_gdpgr ///
  L.wdi_trade L.wdi_gdpcappppcur L.ucdp_type3_4 L.ucdp_type2_new peacekeeinglast10_y_n ///
  if year>1989 & sample1==1, fe cluster(cow)  
vif, uncentered
estat ic
margins, at ( L.KOFPoGIdj=(0(5)100))
marginsplot


//Table 3
//Model 5
xtnbreg  max_troops  L.KOFPoGIdj L.vdem_liberal L.wdi_expmil L.wdi_afpt L.wdi_gdpgr ///
  L.wdi_trade L.wdi_gdpcappppcur L.ucdp_type3_4 L.ucdp_type2_new peacekeeinglast10_y_n ///
  if year>1989 & sample1==1, fe 
 vif, uncentered
estat ic

//Model 6
xtnbreg  max_total_peacekeeper  L.KOFPoGIdj L.vdem_liberal L.wdi_expmil L.wdi_afpt L.wdi_gdpgr ///
  L.wdi_trade L.wdi_gdpcappppcur L.ucdp_type3_4 L.ucdp_type2_new peacekeeinglast10_y_n ///
  if year>1989 & sample1==1, fe   
vif, uncentered
estat ic

//Appandix Table 4 - Model 7
reg  lnmaxUN_troops  L.KOFPoGIdj if year==1990  
vif, uncentered
estat ic

//Descriptive Statistics Table 5
sum lnmaxUN_troops L.lnaid_crsc L.fre_conflict L.KOFPoGIdj L.vdem_liberal L.wdi_expmil L.wdi_afpt ///
L.wdi_gdpgr L.wdi_trade L.max_troops L.ln_max_total_peacekeeper L.max_total_peacekeeper L.wdi_gdpcappppcur  L.ucdp_type3_4 L.ucdp_type2_new peacekeeinglast10_y_n L.gd_ptsa if year>1989 & sample1==1 


//Figure 1 
clear
//data file:Figure 1 Data.dta
use "C:\Users\mjoshi2\Box\2020 Research\Peacekeeping\IP R&R\Edits\RR2\RR2Final\Data\Figure 1 Data.dta", clear
line contributingcountries year, xlabel(none) xtitle("")
graph save Graph "C:\Users\mjoshi2\Box\2020 Research\Peacekeeping\IP R&R\Edits\RR2\RR2Final\Data\Figure 1.a", replace
line numberofmissions year
graph save Graph "C:\Users\mjoshi2\Box\2020 Research\Peacekeeping\IP R&R\Edits\RR2\RR2Final\Data\Figure 1.b", replace
graph combine "C:\Users\mjoshi2\Box\2020 Research\Peacekeeping\IP R&R\Edits\RR2\RR2Final\Data\Figure 1.a""C:\Users\mjoshi2\Box\2020 Research\Peacekeeping\IP R&R\Edits\RR2\RR2Final\Data\Figure 1.b", col(1)


 //Figure 2
 
 clear
 //Data file: Figure 2 and Appendix map data.dta
 use "C:\Users\mjoshi2\Box\2020 Research\Peacekeeping\IP R&R\Edits\RR2\RR2Final\Data\Figure 2 and Appendix map data.dta", replace
 graph bar max_troops if max_troops>25000, over(country, sort(max_troops))
